function callback(data) {
	// alert(data);
	var str = "";
	for ( var i = 0; i < data.length; i++) {
		// 动态的改变页面中div节点中的内容
		str = str + '<tr onclick="selectMerInvById(\'' + data[i].invoiceId
				+ '\')"><td width="100">' + data[i].invoiceCid + '</td>'
				+ '<td width="140">' + data[i].inOutName + '</td>'
				+ '<td width="100">' + data[i].invoiceTypeName + '</td>'
				+ '<td width="80">' + data[i].employeeName + '</td>'
				+ '<td width="100">' + data[i].invoiceDate + '</td>'
				+ '<td width="100">' + data[i].invoiceTotal.toFixed(2)
				+ '</td>' + '<td width="100">' + data[i].storehouseName
				+ '</td>' + '<td width="80">' + data[i].operatorEmpName
				+ '</td>' + '<td width="120">' + data[i].invoiceMemo
				+ '</td></tr>';
	}
	$("#invList").html(str);
}
function selectAllInv() {
	var url = '/stock/pages/routine.do?method=selectInv&d=' + new Date();
	$.getJSON(url, {}, callback);
}
function selectInv() {
	var invCid = $("#invCid").val();
	var type = $("#type").val();
	var beginTime = $("#beginTime").val();
	var endTime = $("#endTime").val();
	var url = '/stock/pages/routine.do?method=selectInv&d=' + new Date()
			+ '&type=' + type + '&invCid=' + invCid + '&beginTime=' + beginTime
			+ '&endTime=' + endTime;
	$.getJSON(url, {}, callback);
}
function callback2(data) {
	// alert(data);
	var str = "";
	for ( var i = 0; i < data.length; i++) {
		// 动态的改变页面中div节点中的内容
		str = str + '<tr><td width="">'
		+data[i].merchandiseName
		+'</td>'
		+'<td width="">'
		+data[i].merchandisePrice
		+'</td>'
		+'<td width="">'
		+data[i].merchandiseAmount
		+'</td>'
		+'<td width="">'
		+data[i].merchandiseTotal
		+'</td></tr>';
	}
	$("#invItems").html(str);
}
function selectMerInvById(id) {
	var url = '/stock/pages/routine.do?method=selectMerInvByInvId&d='
			+ new Date() + '&id=' + id;
	$.getJSON(url, {}, callback2);
}